<template>
  <div class="about">
    <h1 :class="$style.txt" @click="routerClick">最是人间留不住</h1>
    <el-container>
      <el-aside width="200px">
        <!-- router="true" 是否启用 vue-router 模式。 启用该模式会在激活导航时以 index 作为 path 进行路由跳转 使用 default-active 来设置加载时的激活项。-->
        <el-menu
          router="true"
          class="el-menu-vertical-demo"
          background-color="#545c64"
          text-color="#fff"
          default-text-color="#ffd04b"
          active-text-color="#ffd04b"
        >
          <el-menu-item
            :route="i.path"
            v-for="i of tabList"
            :key="i.name"
            :index="i.name"
          >
            <template #title>{{ i.meta.title }}</template>
          </el-menu-item>
        </el-menu>
      </el-aside>
      <el-main>
        <div class="content-box">
          <router-view />
        </div>
      </el-main>
    </el-container>
  </div>
</template>

<script setup>
import { useRoute, useRouter } from "vue-router";
import { reactive } from "@vue/reactivity";
// ----------router系列语法糖:(useRoute, useRouter)----------------------------------------

const route = useRoute();
console.log("useRoute------", route);

const router = useRouter();
console.log("useRouter------", router.options);

let tabList = reactive(router.options.routes[1].children);
console.log("当前路由列表数据------", tabList);
let routerClick = () => {
  router.push("/c");
};
</script>

<style module>
/* style语法糖--------------------:class="$custom.green"*/
.txt {
  color: blue;
  cursor: pointer;
  transition:color .5s ease;
}
.txt:hover {
  color: rgb(47, 179, 255);
}
</style>
